import React from "react";
import * as routerTypes from "@/constants/routerType";

import Home from "@/pages/home";
import AddArticle from "@/pages/addArticle";
import ArticleList from "@/pages/articleList";
import Archives from "@/pages/archives";
import AddFriend from "@/pages/addFriend";
import FriendList from "@/pages/friendList";
import Wall from "@/pages/wall";
import AddMusic from "@/pages/addMusic";
import MusicList from "@/pages/musicList";
import Profile from "@/pages/profile";
import AdminError from "@/components/admin-error";

/**
 * 切换路由
 * @param type {string}
 * @param userId {string | number}
 * @returns {*}
 */
export default function switchRouter(type, userId) {
  switch (type) {
    case routerTypes.HOME:
      return <Home userId={userId}/>
    case routerTypes.ADD_ARTICLE:
      return <AddArticle userId={userId}/>
    case routerTypes.ARTICLE_LIST:
      return <ArticleList userId={userId}/>
    case routerTypes.ARCHIVES:
      return <Archives userId={userId}/>
    case routerTypes.ADD_FRIEND:
      return <AddFriend userId={userId}/>
    case routerTypes.FRIEND_LIST:
      return <FriendList userId={userId}/>
    case routerTypes.WALL:
      return <Wall userId={userId}/>
    case routerTypes.ADD_MUSIC:
      return <AddMusic userId={userId}/>
    case routerTypes.MUSIC_LIST:
      return <MusicList userId={userId}/>
    case routerTypes.PROFILE:
      return <Profile userId={userId}/>
    default:
      return <AdminError/>
  }
}
